<template>
	<view class="news">
		<news-item :list="newsList" @itemClick='geDeatil'></news-item>
	</view>
</template>

<script>
	import newsList from '../../components/news-item/news-item.vue'
	export default {
		data() {
			return {
				newsList:[]
			}
		},
		components:{
			"news-item":newsList
		},
		methods: {
			async getNews(){
				const res = await this.$myRequest({
					url:'/api/getnewslist'
				})
				this.newsList = res.data.message
			},
			geDeatil(id){
				uni.navigateTo({
					url:'/pages/news-detail/news-detail?id=' + id
				})
			}
		},
		onLoad() {
			this.getNews()
		}
	}
</script>

<style lang="scss">
	.news{
		
	}
</style>
